package com.inet.a02_button;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "steven";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        Button btn02 = findViewById(R.id.btn02);
        btn02.setOnClickListener(new View.OnClickListener() {


            @Override
            public void onClick(View view) {
                System.out.println("MainActivity.onClick");
                Log.d(TAG, "onClick: "+ view.getId());
            }
        });


        btn02.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
                System.out.println("MainActivity.onLongClick");
                Log.d(TAG, "onLongClick: "+ view.getId());
                return false;
            }
        });

        btn02.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                System.out.println("motionEvent = " + motionEvent);
                Log.d(TAG, "onTouch: " + motionEvent);
                return false;
            }
        });

    }


    public void btnClick(View view) {
        System.out.println("MainActivity.btnClick");
        Log.d(TAG, "btnClick: " + view.getId());
    }
}